home *** CD-ROM | disk | FTP | other *** search
/ CD Exchange / CD Exchange - Volume 1.iso / graphics / utils / videotracker / develop / sourceaga / picturefade.s < prev    next >
Text File  |  1994-02-10  |  57KB  |  2,772 lines

  1.  
  2. ;rout            ;when this is off, the routine-file will be
  3.             ;assembled, on=testing
  4.             
  5. ;debug            ;when this is on, colors in the background will
  6.             ;show how much time the routine needs.
  7.  
  8. ;ntsctest        ;when this is on, the routineplayer is in ntsc-mode
  9.  
  10. ;ocs            ;off=AGA,on=OCS testing not possible on OCS !
  11.  
  12. routinemode    equ    255*256+17    ;the routinemode !
  13.  
  14.  
  15. ; VideoTracker AGA developer source 25-12-93
  16. ; 24-bits colors, Super-HiRes, HAM8, maximum burstmode (64 pixels aligned)
  17. ; wich makes low-resolution overscan a bit ugly.
  18. ; no "interactive" support anymore, it's only used by Kick 1.3 users.
  19.  
  20. ; the first part of the source handles the things that are necessary to
  21. ; show the picture/copper and playing of the routine.
  22. ; the part between the "***" lines is the routine-source.
  23. ; at the bottom of the file, there are the necessary incbin-files who
  24. ; are needed to test the routine.
  25. ; these are saved with "save effect" in videotracker. they are raw
  26. ; data files which can be fonts,pictures,landscapes,vectorobjects
  27. ; etcetra.
  28. ; the incbin-files are put in the "variables" table, in the routine
  29. ; player-handler
  30. ; the place where it's done can be found by searching for "!!!"
  31.  
  32.     opt    a+    ;devpac 3 optimize
  33.     opt    o+
  34.  
  35. vew_wid    equ    48
  36. vew_hgt    equ    290
  37. win_hgt    equ    117
  38. win_str    equ    $1a
  39.  
  40.         ifd    ocs
  41. pic_wid        equ    4        ;wide in bytes
  42. pic_hgt        equ    6        ;hoogte
  43. pic_dpt        equ    8        ;number planes
  44. pic_ani        equ    10        ;aantal effes (anim)
  45. pic_vew        equ    12        ;viewmode
  46. pic_cycstr    equ    14        ;cycle start (*4)
  47. pic_cycend    equ    15        ;cycle end (*4)
  48. pic_cycspd    equ    16        ;cycle speed (*4)
  49. pic_cycadd    equ    17        ;cycle add (*4)
  50. pic_palnum    equ    30        ;aantal kleuren
  51. pic_pal        equ    32        ;palette start
  52. pic_palsiz    equ    256*2        ;vaste palette size
  53. pic_raw        equ    pic_pal+pic_palsiz    ;palette start
  54.         endc
  55.         
  56.         ifnd    ocs
  57. pic_wid        equ    4        ;wide in bytes
  58. pic_hgt        equ    6        ;hoogte
  59. pic_dpt        equ    8        ;number planes
  60. pic_ani        equ    10        ;aantal effes (anim)
  61. pic_vew        equ    12        ;viewmode
  62. pic_cycstr    equ    14        ;cycle start (*8)
  63. pic_cycend    equ    15        ;cycle end (*8)
  64. pic_cycspd    equ    16        ;cycle speed (*8)
  65. pic_cycadd    equ    17        ;cycle add (*8)
  66. pic_widmod    equ    46        ;animation-width modulo
  67. pic_future    equ    50        ;free future space
  68. pic_palnum    equ    62        ;aantal kleuren
  69. pic_pal        equ    64        ;palette start
  70. pic_palsiz    equ    256*4        ;vaste palette size (longwords)
  71. pic_raw        equ    pic_pal+pic_palsiz    ;palette start
  72.         endc
  73.         
  74. var_len        equ    $300        ;lengte vartabel
  75.  
  76. var__GfxBase    equ    $000        ;graphics lib
  77. var_pic1    equ    $004        ;current picture
  78. var_anispd1    equ    $008        ;animspeed
  79. var_anitel1    equ    $00c        ;animcount
  80. var_cprbck    equ    $010        ;copperback
  81. var_bck        equ    $014        ;background
  82. var_pic2    equ    $018        ;current picture
  83. var_ntsc    equ    $01c        ;ntsc/pal frequence
  84. var_lnd        equ    $020        ;landscape
  85. var_anilop1    equ    $024
  86. var_rottrg    equ    $028        ;effect trigger
  87. var_txt1    equ    $040        ;text
  88. var_txt16    equ    15*4+var_txt1
  89. var_vec1    equ    $080        ;vectors
  90. var_vec16    equ    15*4+var_vec1
  91. var_fon1    equ    $0c0        ;fonts
  92. var_fon16    equ    15*4+var_fon1
  93. var_cols1    equ    $100        ;colorsets
  94. var_cols16    equ    15*4+var_cols1
  95. var_obj1    equ    $180        ;objects
  96. var_obj16    equ    15*4+var_obj1
  97.  
  98.     ifd    rout
  99.     ;videotracker routine-test
  100.  
  101.     incdir    "w:include/"
  102.     include    "exec/types.i"
  103.     include    "graphics/gfxbase.i"
  104.     include    "lvo/graphics_lib.i"
  105.     incdir    'videotracker:effect/'
  106.  
  107.     SECTION    1,CODE_C
  108. tus
  109.     lea    var,a0
  110.  
  111. ;    move.l    #rotincobj,var_obj1(a0)    ;incbinfile !!!
  112. ;    move.l    #rotincbck,var_bck(a0)    ;incbinfile !!!
  113. ;    move.l    #rottube,var_vec1(a0)    ;incbinfile !!!
  114. ;    move.l    #rotsrc,curpal1        ;palette !!!
  115. ;    move.l    #rotset,var_cols1(a0)    ;colorset !!!
  116.  
  117.     bsr    paltabres
  118.     move.l    #rotincpic1,curpic1    ;picture !!!
  119.     move.l    #rotincpic1,curpal1    ;picture !!!
  120.     bsr    grap
  121.     bsr    grac
  122.     move.l    #rotincpic2,curpic1    ;picture !!!
  123.     move.l    #rotincpic2,curpal1    ;picture !!!
  124.     move.l    #rotincpic1,curpic2    ;picture !!!
  125.     move.l    #rotincpic1,curpal2    ;picture !!!
  126.     bsr    grap
  127.     bsr    grac
  128.     
  129.     move.l    ($4).w,a6
  130.     sub.l    a1,a1
  131.     jsr    -$126(a6)        ;findtask
  132.     move.l    d0,curtsk
  133.     move.l    d0,a0
  134.     move.l    $b8(a0),tskpri
  135.  
  136.     lea    dosnam,a1        ;doslib openen
  137.     moveq.l    #0,d0
  138.     move.l    (4).w,a6
  139.     jsr    -408(a6)        ;openlib
  140.     move.l    d0,doslib
  141.  
  142.     bsr.s    label5            ;videotracker opstarten
  143.     
  144.     move.l    curtsk,a0
  145.     move.l    tskpri,$b8(a0)
  146.     move.l    ($4).w,a6
  147.     jsr    -$84(a6)        ;forbid
  148.  
  149.     move.l    doslib,a1
  150.     move.l    (4).w,a6
  151.     jsr    -414(a6)        ;closelib
  152.  
  153.     moveq.l    #0,d0
  154.     rts
  155.     
  156. label5
  157.     move.l    (4).w,a6        ;workbench gedoe
  158.  
  159.     move.b    530(a6),ntscmode    ;50/60 hertz halen
  160.  
  161.     ifd    ntsctest
  162.     move.b    #60,ntscmode        ;60 hertz (ntsc)
  163.     endc
  164.  
  165.     cmp.b    #50,ntscmode        ;ntsc ?
  166.     beq.s    str.ntsc
  167.     move.l    #vew_hgt-56,hogscr    ;set NTSC screen hight
  168. str.ntsc
  169.  
  170.     lea    cprjmp,a2        ;copjmp zetten !
  171.     move.l    #cprbck-8,d0
  172.     move.w    d0,6(a2)
  173.     swap    d0
  174.     move.w    d0,2(a2)
  175.  
  176.     lea    cprbck-8,a2        ;copstr zetten !
  177.     move.l    #cpr,d0
  178.     move.w    d0,6(a2)
  179.     swap    d0
  180.     move.w    d0,2(a2)
  181.  
  182.     bsr    cprsprrem        ;sprites legen
  183.  
  184.     lea    gfxnam,a1        ;graphics lib openen
  185.     move.l    (4).w,a6
  186.     jsr    -408(a6)        ;openlib
  187.     move.l    d0,a6
  188.     move.l    d0,gfxlib
  189.     move.l    38(a6),oldcprlist
  190.  
  191.     bset    #1,$bfe001
  192.     bsr    copbuf            ;copper vullen
  193.  
  194.     bsr    sysoff
  195.  
  196. gadrun
  197.     btst    #6,($bfe001).l
  198.     bne    gadrun
  199.  
  200. scrend
  201. scrend.play
  202.     bsr    syson
  203.  
  204.     move.l    gfxlib,a1
  205.     move.l    (4).w,a6
  206.     jsr    -414(a6)        ;closelib
  207.  
  208. scrend.qb
  209.     moveq.l    #0,d0    
  210.     rts
  211.     
  212.     ;vertical blank interrupt, no blits.
  213.     ;handles counters,interlace,sprite
  214.     ;level 3
  215.  
  216. intvb
  217.     bra.s    intvb.cnt
  218.     dc.l    'VIDU'
  219.     dc.l    'LOOP'
  220. intvb.cnt
  221.     movem.l    d0-d7/a0-a6,-(sp)
  222.     lea    ($dff000).l,a6
  223.  
  224.     move.w    $01e(a6),d0
  225.     btst    #5,d0            ;vblank ?
  226.     bne.s    intvb.vb
  227.  
  228.     bra.s    intcop.end
  229.  
  230. intvb.vb
  231.     bsr    grap
  232.     bsr    palctr            ;palette zetten
  233.     bsr.s    copbuf            ;copper vullen
  234.     
  235. intvb.end
  236.     move.w    #$0020,$09c(a6)    ;vb bit wissen
  237.     movem.l    (sp)+,d0-d7/a0-a6    ;multitask uit, shit !
  238.     rte
  239.  
  240. intcop.end
  241.     movem.l    (sp)+,d0-d7/a0-a6
  242.     move.l    intvbold,-(sp)
  243.     rts
  244.  
  245.     ;transmission buffer empty routine, BLIT !
  246.     ;handles routines,animations
  247.     
  248. inttbe                    ;tbe interrupt
  249.     movem.l    d0-d7/a0-a6,-(sp)
  250.     lea    ($dff000).l,a6
  251.  
  252.     move.w    $01e(a6),d0
  253.     btst    #0,d0            ;no tbe ?
  254.     beq.s    intdskblk
  255.  
  256.  
  257.     btst    #6,($bfe001).l        ;muis ingedrukt ?
  258.     beq.s    inttbe.cop
  259.     btst    #2,($dff016).l
  260.     beq.s    inttbe.cop
  261.  
  262.     ifd    debug
  263.     move.w    #$700,$dff180
  264.     endc
  265.     
  266.     bsr    rotply            ;routineplayer BLIT !
  267.     bsr.s    copbuf            ;copper vullen
  268.  
  269.     ifd    debug
  270.     move.w    #$070,$dff180
  271.     endc
  272.     
  273. inttbe.cop
  274.  
  275. inttbe.end
  276.     move.w    #$0001,$09c(a6)
  277.     movem.l    (sp)+,d0-d7/a0-a6
  278.     rte
  279.  
  280. intdskblk
  281.     move.w    #$0001,$09c(a6)        ;be sure for no tbe handling
  282.     movem.l    (sp)+,d0-d7/a0-a6
  283.     move.l    inttbeold,-(sp)
  284.     rts
  285.  
  286.  
  287.     ;moves the copperbuffer to the copperlist
  288.     ;sort of double buffering
  289.     
  290. copbuf
  291.     movem.l    d0-d7/a0-a6,-(sp)
  292.  
  293.     lea    ($dff000).l,a6
  294.  
  295. copbuf.novb                ;copperchange overslaan
  296.     moveq.l    #0,d0
  297.     move.b    $005(a6),d0
  298.     lsl.w    #8,d0
  299.     moveq.l    #0,d1
  300.     move.b    $006(a6),d1
  301.     add.w    d1,d0
  302.  
  303.     cmp.w    #$4,d0            ;lower limit, all stations 100%
  304.     blt    copbuf.novb
  305.  
  306.     cmp.b    #50,ntscmode
  307.     beq.s    copbuf.pal
  308.     cmp.w    #$133-72-8,d0        ;ntsc grens
  309.     bge    copbuf.novb
  310.     bra.s    copbuf.cont
  311. copbuf.pal
  312.     cmp.w    #$133-8,d0        ;pal grens
  313.     bge    copbuf.novb
  314. copbuf.cont
  315.  
  316.     lea    gra.s,a0        ;buffer copieren
  317.     lea    cprbuf,a1
  318. copbuf_aga                ;AGA stuff :)
  319.     move.l    #(gra.ql)/4-1,d0
  320. copbuf.a
  321.     move.w    2(a0),2(a1)
  322.     add.l    #4,a0
  323.     add.l    #4,a1
  324.     dbra    d0,copbuf.a
  325.  
  326. copbuf.end
  327.     movem.l    (sp)+,d0-d7/a0-a6
  328.     rts
  329.  
  330.     ;goes back to the workbench
  331.     
  332. syson
  333.     movem.l    d0-d7/a0-a6,-(sp)
  334.  
  335.     move.w    #$0001,$dff09a        ;tbeint uit
  336.     move.l    intvbold,($6c).w
  337.     move.l    inttbeold,($64).w
  338.  
  339.     move.l    4,a6
  340.     jsr    -138(a6)        ;permit
  341.  
  342.     move.l    gfxlib,a6
  343.     jsr    -462(a6)        ;disownblitter
  344.  
  345.     move.l    wbview,a1
  346.     move.l    gfxlib,a6
  347.     jsr    _LVOLoadView(a6)     ; Fix view
  348.     jsr    _LVOWaitTOF(a6)
  349.     jsr    _LVOWaitTOF(a6)         ; wait for LoadView()
  350.  
  351. syson.ras
  352.     cmp.b    #$c0,$dff006        ;prevent copperjump
  353.     bne    syson.ras
  354.  
  355.     move.l    gfxlib,a6
  356.     move.l    gb_copinit(a6),$dff080     ; Kick it into life
  357.  
  358.     movem.l    (sp)+,d0-d7/a0-a6
  359.     rts
  360.     
  361.     ;goes back to the gadgetscreen
  362.     
  363. sysoff
  364.     movem.l    d0-d7/a0-a6,-(sp)
  365.      
  366.     move.l    gfxlib,a6
  367.     move.l    gb_ActiView(a6),wbview    ;current view
  368.     sub.l    a1,a1            ; clear a1
  369.     jsr     _LVOLoadView(a6)     ; Flush View to nothing
  370.     jsr    _LVOWaitTOF(a6)     ; Wait once
  371.     jsr    _LVOWaitTOF(a6)     ; Wait again.
  372.  
  373.     move.l    gfxlib,a6
  374.     jsr    -456(a6)        ;ownblitter
  375.  
  376.     move.l    4,a6
  377.     jsr    -132(a6)        ;forbid
  378.         
  379.     move.l    ($6c).w,intvbold
  380.     move.l    #intvb,($6c).w
  381.     move.l    ($64).w,inttbeold
  382.     move.l    #inttbe,($64).w
  383.     move.w    #$8001,$dff09a        ;tbeint aan
  384.     bsr    gracpr            ;reset copper
  385.     bsr    copbuf            ;copy copper
  386.     move.l    #cpr,$dff080
  387.  
  388.     movem.l    (sp)+,d0-d7/a0-a6
  389.     rts
  390.     
  391. cprsprrem
  392.     movem.l    d0-d7/a0-a6,-(sp)
  393.     lea    cprspr,a0
  394.     move.l    #sprdat,d0
  395.     move.w    #7,d1
  396. cprsprrem.a
  397.     move.w    d0,3*2